<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/1/22
  Time: 14:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

</body>
<script>
var socket;
if (typeof(WebSocket) == "undefined") {
    console.log("您的浏览器不支持WebSocket");
} else {
    console.log("您的浏览器支持WebSocket");//www.test.bizvane.cn/wechatEnterprise
    socket = new WebSocket("ws://localhost:8083/websocket/${cid}".replace("http","ws"));
    socket.onopen = function () {
        console.log("Socket 已打开");
        socket.send("这是来自客户端的消息" + location.href + new Date());
    };
    socket.onmessage = function (msg) {
        console.log(msg.data);
    };
    socket.onclose = function () {
        console.log("Socket已关闭");
    };
    socket.onerror = function () {
        alert("Socket发生了错误");
    }
} </script>

</html>
